﻿<%@ Page Title="" Language="C#" MasterPageFile="~/SkyFab.Master" AutoEventWireup="true" CodeBehind="EditVendorPO.aspx.cs" Inherits="Web.EditVendorPO" %>
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <style type="text/css">
        .style1
        {
            text-align: right;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="SubMenuPlaceHolder" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
<asp:Label ID="FlashMessageLabel" runat="server"></asp:Label>
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<h1>Edit Vendor PO: <asp:Label ID="CurrentPONolabel" runat="server"></asp:Label></h1>
    
    <div class="span-9">
    <fieldset>
    <legend>Vendor Information</legend>

    <p>
    <label>Vendor:</label>
    <asp:DropDownList ID="VendorDropDownList" runat="server" Width="180"></asp:DropDownList>
    </p>

    <p>
    <label></label>
    </p>
    </fieldset>

    <fieldset>
    <legend>Shipping Address</legend>

    <p><label>Ship-To: (Customer Address)</label></p>
    <p>
        <asp:TextBox ID="AddressTextBox1" runat="server" CssClass="text span-7"></asp:TextBox>
    <asp:RequiredFieldValidator ID="AddressTextBoxRequiredFieldValidator" runat="server" 
                    ControlToValidate="AddressTextBox1" ErrorMessage="*" ForeColor="Red"></asp:RequiredFieldValidator>
    </p>

    <p> 
        <asp:TextBox ID="AddressTextBox2" runat="server"  CssClass="text span-7"></asp:TextBox>
    </p>
    <p>
        <asp:TextBox ID="AddressTextBox3" runat="server"  CssClass="text span-7"></asp:TextBox>
    </p>

    <p>
        <label>Zip Code:</label>
        <asp:TextBox ID="ZipCodeTextBox" runat="server" Width="160" CssClass="text"></asp:TextBox>
    </p>




    <p>
    <label>Attention:</label>
    <asp:TextBox ID="AttentionTextBox" runat="server" Width="160" CssClass="text"></asp:TextBox>
    </p>

    <p>
    <label>Phone:</label>
    <asp:TextBox ID="PhoneTextBox" runat="server" Width="160" CssClass="text"></asp:TextBox>
    </p>

    <p>
    <label>Fax:</label>
    <asp:TextBox ID="FaxTextBox" runat="server" Width="160" CssClass="text"></asp:TextBox>
    </p>
    </fieldset>
    </div>

    <div class="span-9">
    <fieldset>
    <legend>PO Information</legend>

     <p>
                <asp:RadioButtonList ID="POTypeRadioButtonList" runat="server" RepeatDirection="Horizontal">
                <asp:ListItem Text="Purchase Order" Value="purchase" Selected="True"/>
                <asp:ListItem Text="Contract Order" Value="contract" />
                </asp:RadioButtonList>
    </p>

    <p>
    <label>PO No:</label>
    <asp:TextBox ID="VendorPONoTextBox" runat="server" Width="160" CssClass="text"></asp:TextBox>
    <asp:RequiredFieldValidator ID="VendorPONoTextBoxRequiredFieldValidator" runat="server" 
                    ControlToValidate="VendorPONoTextBox" ErrorMessage="*" ForeColor="Red"></asp:RequiredFieldValidator>
    </p>

    <p>
    <label>Quotation No:</label>
    <asp:TextBox ID="RefereceTextBox" runat="server" Width="160" CssClass="text"></asp:TextBox>
    </p>
    
    
    <p>
    <label>Total Qty:</label>
    <asp:TextBox ID="TotalQtyTextBox" runat="server" CssClass="text" Width="150"></asp:TextBox>
    </p>
    <p>(This field(Total Qty) is ONLY for contract order! Leave it blank for purchase order.)</p>


    <p>
    <label>Created By:</label>
    <asp:TextBox ID="CreatedByTextBox" runat="server" Width="160" CssClass="text"></asp:TextBox>
    <asp:RequiredFieldValidator ID="CreatedByTextBoxRequiredFieldValidator" runat="server" 
                                    ErrorMessage="*" ControlToValidate="CreatedByTextBox" ForeColor="Red">
                                </asp:RequiredFieldValidator>
    </p>

    <p>
    <label>Approved By:</label>
    <asp:TextBox ID="ApprovedByTextBox" runat="server" Width="160" CssClass="text"></asp:TextBox>
    <asp:RequiredFieldValidator ID="ApprovedByTextBoxRequiredFieldValidator" runat="server" 
                                    ErrorMessage="*" ControlToValidate="ApprovedByTextBox" ForeColor="Red">
                                </asp:RequiredFieldValidator>
    </p>

    <p>
    <label>Remark:</label>
    <asp:TextBox ID="RemarkTextBox" runat="server" Height="47px" 
        TextMode="MultiLine" Width="260px"></asp:TextBox>
    </p>
    </fieldset>
    </div>

    
    <div class="span-18">
    <fieldset>
    <legend>Summary</legend>
        <p class="notice">Summary: This is a <asp:Label ID="SummaryPOTypeLabel" runat="server" /> order. Total open qty is <asp:Label ID="SummaryTotalOpenQtyLabel" runat="server" />.</p>
    </fieldset>
    </div>

    <div class="span-18">
    <fieldset>
    <legend>Select Product</legend>

    <p>
    <label>Product No/Revision:</label>
    <asp:DropDownList ID="NoAndRevDropDownList" runat="server" AutoPostBack="True" 
        onselectedindexchanged="NoAndRevDropDownList_SelectedIndexChanged" Width="180"></asp:DropDownList>
    
    <label>Requested Date:</label>
    <asp:TextBox ID="InsertRequestedDateTextBox" runat="server" Width="150" CssClass="text"></asp:TextBox>
    <asp:CalendarExtender ID="InsertRequestedDateTextBox_CalendarExtender" runat="server" 
                        Enabled="True" TargetControlID="InsertRequestedDateTextBox" Format="d MMM, yyyy"></asp:CalendarExtender>
    <asp:RequiredFieldValidator ID="InsertRequestedDateTextBoxRequiredFieldValidator" runat="server" 
                                    ErrorMessage="*" ControlToValidate="InsertRequestedDateTextBox" ForeColor="Red">
                                </asp:RequiredFieldValidator>
    </p>

    <p>
    <label>Product Name:</label>
    <asp:Label ID="ProductNameLabel" runat="server"></asp:Label>
    </p>

    <p>
    <label>Quantity:</label>
    <asp:TextBox ID="InsertQtyTextBox" runat="server" Width="60" CssClass="text"></asp:TextBox>
                                <asp:RegularExpressionValidator ID="InsertQtyTextBoxRegularExpressionValidator" runat="server" 
                                ControlToValidate="InsertQtyTextBox" ErrorMessage="*" ForeColor="Red" 
                                ValidationExpression="^[1-9]\d*$">
                                </asp:RegularExpressionValidator>

    <label>Net Price(SGD):</label>
    <asp:TextBox ID="InsertPriceTextBox" runat="server" Width="60" CssClass="text"></asp:TextBox>
                                <asp:RegularExpressionValidator ID="InsertPriceTextBoxRegularExpressionValidator" runat="server" 
                                ControlToValidate="InsertPriceTextBox" ErrorMessage="*" ForeColor="Red" 
                                ValidationExpression="^[0-9]+(.[0-9]{1,2})?$">
                                </asp:RegularExpressionValidator>

    <label>Lot:</label>
    <asp:TextBox ID="InsertLotTextBox" runat="server" Width="60" CssClass="text"></asp:TextBox>
                                <asp:RegularExpressionValidator ID="InsertLotTextBoxRegularExpressionValidator" runat="server" 
                                ControlToValidate="InsertLotTextBox" ErrorMessage="*" ForeColor="Red" 
                                ValidationExpression="^[1-9]\d*$">
                                </asp:RegularExpressionValidator>

    <asp:Button ID="InsertButton" runat="server" Text="Insert" 
        onclick="InsertButton_Click" CssClass="submitButton" />
    </p>
    </fieldset>
    </div>


    <div class="span-18">
    <fieldset>
    <legend>Product List</legend>

    <p>
    <asp:GridView ID="VendorPOItemGridView" runat="server" CssClass="gridview" 
        AutoGenerateColumns="False">
    <Columns>
        <asp:BoundField DataField="NoAndRev" HeaderText="No. &amp; Rev" />

        <asp:TemplateField HeaderText="Qty">
        <ItemTemplate>
                    <asp:TextBox ID="QtyTextBox" runat="server" Width="38px"  Text='<%#Eval("RequestQty") %>' />
                    <asp:RequiredFieldValidator ID="QtyTextBoxRequiredFieldValidator" runat="server" 
                    ControlToValidate="QtyTextBox" ErrorMessage="*" ForeColor="Red">
                    </asp:RequiredFieldValidator>
                    <asp:RegularExpressionValidator ID="QtyTextBoxRegularExpressionValidator" runat="server" 
                                ControlToValidate="QtyTextBox" ErrorMessage="*" ForeColor="Red" 
                                ValidationExpression="^[1-9]\d*$">
                                </asp:RegularExpressionValidator>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Price(SGD)">
        <ItemTemplate>
                    <asp:TextBox ID="PriceTextBox" runat="server" Width="38px" Text='<%#Eval("Price") %>' />
                    <asp:RequiredFieldValidator ID="PriceTextBoxRequiredFieldValidator" runat="server" 
                    ControlToValidate="PriceTextBox" ErrorMessage="*" ForeColor="Red"></asp:RequiredFieldValidator>
                    <asp:RegularExpressionValidator ID="PriceTextBoxTextBoxRegularExpressionValidator" runat="server" 
                                ControlToValidate="PriceTextBox" ErrorMessage="*" ForeColor="Red" 
                                ValidationExpression="^[0-9]+(.[0-9]{2})?$">
                                </asp:RegularExpressionValidator>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Lot">
        <ItemTemplate>
                    <asp:TextBox ID="LotTextBox" runat="server" Width="38px" Text='<%#Eval("Lot") %>' />
                    <asp:RequiredFieldValidator ID="LotTextBoxRequiredFieldValidator" runat="server" 
                    ControlToValidate="LotTextBox" ErrorMessage="*" ForeColor="Red"></asp:RequiredFieldValidator>
                    <asp:RegularExpressionValidator ID="LotTextBoxRegularExpressionValidator" runat="server" 
                                ControlToValidate="LotTextBox" ErrorMessage="*" ForeColor="Red" 
                                ValidationExpression="^[1-9]\d*$">
                                </asp:RegularExpressionValidator>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="RequestDate">
        <ItemTemplate>
                    <asp:TextBox ID="RequestDateTextBox" runat="server" Width="65px" Text='<%#Eval("FormatDate") %>'/>
                    <asp:CalendarExtender ID="RequestDateTextBox_CalendarExtender" runat="server" 
                        Enabled="True" TargetControlID="RequestDateTextBox" Format="d MMM, yyyy">
                    </asp:CalendarExtender>
                    <asp:RequiredFieldValidator ID="RequestDateTextBoxRequiredFieldValidator" runat="server" 
                    ControlToValidate="RequestDateTextBox" ErrorMessage="*" ForeColor="Red"></asp:RequiredFieldValidator>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Remark">
        <ItemTemplate>
                    <asp:TextBox ID="RemarkTextBox" runat="server" Text='<%#Eval("Remark") %>'  CssClass="text" Width="50"/>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Action">
            <ItemTemplate>
                <asp:Button ID="DeleteVendorPOItemButton" runat="server" Text="Del"  ToolTip="Delete" 
                    onclick="DeleteVendorPOItemButton_Click" OnClientClick="if(confirm('Record will be deleted from databse, are you sure?')==false){return false;}"  CssClass="submitButton" />
                    <br />
                <asp:Button ID="CloseButton" runat="server" Text="C/O"  ToolTip="Close/Open"  
                onclick="CloseVendorPOItemButton_Click" CssClass="submitButton"/>  
            </ItemTemplate>
        </asp:TemplateField>
         <asp:TemplateField HeaderText="Status">
            <ItemTemplate>
                <asp:Label ID="StatusLabel" runat="server" Text='<%#Eval("Status") %>' />    
            </ItemTemplate>
        </asp:TemplateField>
    </Columns>
    
                    <AlternatingRowStyle BackColor="White" />
                    <EditRowStyle BackColor="#2461BF" />
                    <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                    <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                    <PagerStyle HorizontalAlign="Center" CssClass="pagerTable" />
                    <RowStyle BackColor="#EFF3FB" />
                    <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                    <SortedAscendingCellStyle BackColor="#F5F7FB" />
                    <SortedAscendingHeaderStyle BackColor="#6D95E1" />
                    <SortedDescendingCellStyle BackColor="#E9EBEF" />
                    <SortedDescendingHeaderStyle BackColor="#4870BE" />
    </asp:GridView>
    </p>
    </fieldset>
    </div>
    
    <div class="span-18">
    <asp:Button ID="SubmitButton" runat="server" Text="Submit" 
        onclick="SubmitButton_Click" CssClass="submitButton"/>
    </div>

</asp:Content>
